

// `NanoSecond` is a new name for `u64`.
type NanoSecond = u64;
type Inch = u64;

// Use an attribute to silence warning.
#[allow(non_camel_case_types)]
type u64_t = u64;
// TODO ^ Try removing the attribute

pub fn aliasing_test() {
    println!("类型的别名：type NanoSecond = u64;将NanoSecond指定为u64类型。赋值时sa一次也行let nanoseconds: NanoSecond = 5 as u64_t;");
    println!("NanoSecond` = `Inch` = `u64_t` = `u64`.");
    let nanoseconds: NanoSecond = 5 as u64_t;
    let inches: Inch = 2 as u64_t;

    // Note that type aliases *don't* provide any extra type safety, because
    println!("aliases are *not* new types 注意： 别名不是一个新类型");
    println!("{} nanoseconds + {} inches = {} unit?",
             nanoseconds,
             inches,
             nanoseconds + inches);
}